package com.s3.khospitalds.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.s3.khospitalds.entity.DoctorResignInfo;
import com.s3.khospitalds.entity.Hasnurse;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: xw
 * @CreateTime: 2025/2/20
 * @Description: 护士
 * @Version: 1.0
 */
@Mapper
@Repository
public interface HasnurseMapper extends BaseMapper<Hasnurse> {
    @Select("SELECT * FROM hasnurse")
    public List<Hasnurse> getAllHasnurse();
    public List<Hasnurse> findByDepartmentAndName(@Param("department") String department,@Param("name") String name);
    @Insert("INSERT INTO hasNurse (`name`, address, sex, age, `position`, department, education, profession, `date`, `isexpert`) VALUES\n" +
            "(#{name} , #{address} , #{sex} ,#{age} , #{position} , #{department} , #{education} , #{profession} , #{date} , 1 )")
    public int insertHasnurse(Hasnurse hasnurse);
    @Update("UPDATE hasnurse SET `name`=#{name} , address=#{address} , sex=#{sex} , age=#{age} , `position`=#{position} , department=#{department} , education=#{education} , profession=#{profession} , `date`=#{date}  WHERE id=#{id} ")
    public int updateHasnurse(Hasnurse hasnurse);
    @Delete("DELETE FROM hasnurse WHERE id=#{id} ")
    public int deleteHasnurse(int id);

    @Update("UPDATE hasnurse SET isexpert = 2, leave_date = NOW(), reason = #{reason}, processor = #{processor} WHERE id = #{id}")
    public int updateHasnurseResign(DoctorResignInfo doctorResignInfo);

}
